#include<iostream>
#include<conio.h>
using namespace std;
long start,stop,len=0;
long maxLen=0;
char *ch=new char[100005];
char action[100005];
long id=0;
void input(){
    cin>>ch;
    len=0;
    while(ch[len]!='\0')len++;
}
int find(){
    long i,j;
    maxLen=0;
    long _start=0,maxStart=0,_len=0;
    for(i=0;i+1<len;i+=2){
        if(ch[i]!=ch[i+1]){
            _len+=2;
            if(_len>maxLen){
                maxLen=_len;
                maxStart=start;
            }
        }else{
            start=i+2;
            _len=0;
        }
    }
    _len=0;
    for(i=1;i+1<len;i++){
        if(ch[i]!=ch[i+1]){
           _len+=2;
           if(_len>maxLen){
                maxLen=_len;
                maxStart=start;
            }
        }else{ 
            start=i+2;
            _len=0;
        }
    }
    return maxStart;
}
void process(){
    long i;
    do{
        start=find();
        for(i=0;i<start;i++)
            action[id++]=ch[i];
        for(i=len-1;i>=start+maxLen;i--)
            action[id++]=2+ch[i];
        for(i=0;i<maxLen/2;i++)
                ch[i]=ch[start+i*2];
            if(maxLen>0)action[id++]='4';
        len=maxLen/2;
        ch[len]='\0';
    }while(len>0);
}
void output(){
    if(id>100){
        cout<<-1;
        return;
    }
    cout << id;
    for(long i=id-1;i>=0;i--){
        switch (action[i]){
            case '0':cout<<endl<<"front 0";break;
            case '1':cout<<endl<<"front 1";break;
            case '2':cout<<endl<<"back 0";break;
            case '3':cout<<endl<<"back 1";break;
            case '4':cout<<endl<<"double";break;
        }
    }
}
            
int main(){
    
    input();
    process();
    output();
    getch();
    return 0;
}
